package com.netinfo.learning.commonservice.controller;


import com.netinfo.serviceapi.entity.User;
import com.netinfo.serviceapi.service.HelloServiceApi;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;
@RestController
public class SendEmailController {
    Logger logger = LoggerFactory.getLogger(SendEmailController.class);
    @Autowired
    DiscoveryClient discoveryClient;

    @RequestMapping("/hello")
    public String hello() {
        ServiceInstance instance = discoveryClient.getLocalServiceInstance();
        //打印服务的服务id
        logger.info("*********注册的服务被调用" + instance.getServiceId());
        return "common-service调用。。。。。。。";
    }

//    @Override
//    public String hello2() {
//        logger.info("*********注册的服务hello2接口被调用");
//        return "请求service-api种的接口hello2;common-service继承接口，实现其方法";
//    }
//
//    @Override
//    public User printUser(@RequestBody User user) {
//        logger.info("*********注册的服务printUser接口调用");
//        return user;
//    }
}
